<?php
$pdo = new PDO("mysql:dbname=caipin;host=127.0.0.1;charset=UTF8","root","root");
$sql = $pdo->prepare("select * from cai;");
$sql->execute();
$arr = $sql->fetchall(PDO::FETCH_NAMED);

var_export ($arr);
?>